package com.itheima.search.controller;

import com.itheima.search.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    GoodsService goodsService;

    @PostMapping("/data")
    public String getCondition(@RequestBody Map<String,String> condition){
        condition.forEach((key, value) ->
            System.out.println(key + "：" + value)
        );
        return goodsService.selectGoods(condition);
    }
}
